<?php
 $this->widget('zii.widgets.CBreadcrumbs', array(
     'homeLink' => '<b style="color:white">Модули</b>',
    'links'=>array(
    'Гостевая книга',
    ),
    'htmlOptions' => array(
    'class' => 'breadcrumb',
    'style' => 'background: #F48B31;',
    ),
 )); 
 ?>

<?php
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('gbook-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h3 style="color: orange;">Гостевая книга</h3>
<hr />


<?php $this->widget('bootstrap.widgets.TbGridView', array(
	'id'=>'gbook-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'id'=>array(
            'name'=>'id',
            'sortable'=>false,
            'header'=>'<div style='.Yii::app()->params['headerTextStyle'].'>ID</div>',
            'htmlOptions'=>array('style'=>'width:50px'),
            'headerHtmlOptions'=>array('style'=>Yii::app()->params['headerStyle'].'border-radius:10px 0 0 0'),
        ),
		'login'=>array(
            'name'=>'login',
            'sortable'=>false,
            'header'=>'<div style='.Yii::app()->params['headerTextStyle'].'>Имя</div>',
            'htmlOptions'=>array('style'=>'width:150px'),
            'headerHtmlOptions'=>array('style'=>Yii::app()->params['headerStyle']),
        ),
		'email'=>array(
            'name'=>'email',
            'sortable'=>false,
            'header'=>'<div style='.Yii::app()->params['headerTextStyle'].'>E-mail</div>',
            'headerHtmlOptions'=>array('style'=>Yii::app()->params['headerStyle']),
        ),
		'message'=>array(
            'name'=>'message',
            'sortable'=>false,
            'header'=>'<div style='.Yii::app()->params['headerTextStyle'].'>Сообщение</div>',
            'value'=>'substr($data->message, 0, 150)',
            'filter'=>false,
            'htmlOptions'=>array('style'=>'width:300px'),
            'headerHtmlOptions'=>array('style'=>Yii::app()->params['headerStyle']),
        ),
		'answer'=>array(
            'name'=>'answer',
            'sortable'=>false,
            'header'=>'<div style='.Yii::app()->params['headerTextStyle'].'>Ответ</div>',
            'value'=>'substr($data->message, 0, 150)',
            'filter'=>false,
            'headerHtmlOptions'=>array('style'=>Yii::app()->params['headerStyle']),
        ),
		'date'=>array(
            'name'=>'date',
            'sortable'=>false,
            'header'=>'<div style='.Yii::app()->params['headerTextStyle'].'>Дата</div>',
            'value'=>'date("j-m-Y", $data->date)',
            'filter'=>false,
            'htmlOptions'=>array('style'=>'width:100px'),
            'headerHtmlOptions'=>array('style'=>Yii::app()->params['headerStyle']),
        ),
		'status'=>array(
            'name'=>'status',
            'sortable'=>false,
            'header'=>'<div style='.Yii::app()->params['headerTextStyle'].'>Статус</div>',
            'type'=>'html',
            'value'=>'($data->status==1)?"<b style=\"color:green\">Опубликовано</b>":"Не опубликовано"',
            'filter'=>array(1=>'Опубликовано', 0=>'Не опубликовано'),
            'htmlOptions'=>array('style'=>'width:150px'),
            'headerHtmlOptions'=>array('style'=>Yii::app()->params['headerStyle']),
        ),
		
			array(
			'class'=>'bootstrap.widgets.TbButtonColumn',
            'viewButtonOptions'=>array('style'=>'display:none'),
            'headerHtmlOptions'=>array('style'=>Yii::app()->params['headerStyle'].'border-radius:0 10px 0 0'),
		),
	),
)); ?>


